; Sort2DArray
; -----------
; Index based sorting of a 2D array by one or more columns. Returns the
; sorting index as a DllStruct (Sort2DArray) or an array (Sort2DArrayOpt).
; Sort2DArray( _
;     $aArray, _  ; The 2D array to be sorted by index
;     $aCompare ) ; Info about columns used in sorting, see 1) in docu


; 1) $aCompare parameter
; The $aCompare parameter contains information about the columns in $aArray to be used for sorting. The generel
; format of $aCompare is a 2D array with one row of information for each column that's included in the sorting.
;
; The purpose of using multiple columns in the sorting is to be able to handle duplicates. If there are dupli-
; cates in first sorting column, they can be sorted by the second sorting column. If there are duplicates in
; second sorting columns, they can be sorted by third sorting column.
;
; Each row in $aCompare consists of 3 fields: The zero based column index, an indication of whether the column
; should be sorted as numbers or strings, and an indication of ascending or descending sorting order.
;
; In the example below an array is sorted by the three first columns. The second column is used only on dupli-
; cates in first column. The third column is used only on duplicates in both first and second columns.
;
; Local $aCompare = [ _
;     [ 0, 1, 0 ], _ ; Column 0: Compare as strings, ascending order
;     [ 1, 0, 0 ], _ ; Column 1: Compare as numbers, ascending order
;     [ 2, 0, 0 ] ]  ; Column 2: Compare as numbers, ascending order
;
; The second field in each row in $aCompare indicates whether the column should be sorted as numbers or strings.
; 0 or "" means that the column is sorted as numbers. Everything else means that it's sorted as strings.
;
; The third field indicates whether the column should be sorted in ascending or descending order. 0 or "" means
; that the column is sorted in ascending order. Everything else means that it's sorted in descending order.
;
; Because of default values in an array, the example above can be written slightly shorter this way:
;
; Local $aCompare = [ _
;     [ 0, 1 ], _ ; Column 0: Compare as strings, ascending order
;     [ 1    ], _ ; Column 1: Compare as numbers, ascending order
;     [ 2    ] ]  ; Column 2: Compare as numbers, ascending order
;
;
; If an array is to be sorted by multiple columns and all columns are sorted as numbers in ascending order,
; $aCompare can be specified as a 1D array:
;
; Local $aCompare = [ 1, 2, 3 ]
;
; Here an array is sorted by second, third and fourth column as numbers in ascending order.
;
;
; If an array is to be sorted by a single column as numbers in ascending order $aCompare can be specified
; simply as the column index:
;
; Local $aCompare = 1 ; Sort an array by second column as numbers in ascending order.
